home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 1 / Amiga Tools.iso / egs-tools / egs_dev-disk / egsdemos / egsexamples / asm / window.asm < prev    next >
Encoding:
Assembly Source File  |  1994-06-06  |  4.4 KB  |  231 lines

  1. *
  2. *  window.asm -- Asm example that calls the EGS functions
  3. *
  4. *  $
  5. *  $ FILE     : E_G_S:Wartung&Pflege/A-Include/egs/window.asm
  6. *  $ VERSION  : 1
  7. *  $ REVISION : 21
  8. *  $ DATE     : 05-Mar-93 19:03
  9. *  $
  10. *  $ Author   : mvk
  11. *  $
  12. *
  13. *  This programm is opens a EI_Window with
  14. *  an rectangle in it.
  15. *  It's only to show that the ASM-Stuff works
  16. *
  17. *
  18. * (c) Copyright 1990/93 VIONA Development
  19. *     All Rights Reserved
  20. *
  21. *
  22.  
  23.    INCLUDE   "exec/types.i"
  24.    INCLUDE   "exec/macros.i"
  25.    INCLUDE   "exec/libraries.i"
  26.    INCLUDE   "exec/nodes.i"
  27.    INCLUDE   "exec/ports.i"
  28.  
  29.    INCLUDE   "egs/all.i"
  30.  
  31.    XDEF   _main
  32.  
  33.    XREF   _printf
  34.    XREF   _AbsExecBase
  35.  
  36.  
  37.    EXTERN_LIB   OpenLibrary
  38.    EXTERN_LIB   CloseLibrary
  39.    EXTERN_LIB   GetMsg
  40.    EXTERN_LIB   WaitPort
  41.    EXTERN_LIB   ReplyMsg
  42.  
  43.  
  44.  STRUCTURE  my_libs,0
  45.     APTR    my_egsgfx
  46.     APTR    my_egsintui
  47.     APTR    my_win
  48.     APTR    my_rast
  49.     APTR    my_port
  50.     APTR    my_msg
  51.     LABEL   my_SIZE
  52.  
  53.         section   code
  54.  
  55.  
  56. _main:
  57.    ;------ open the test library: this will bring it in from disk
  58.  
  59.         move.l   _AbsExecBase,a6
  60.         lea      -my_SIZE(a7),a7           ;Sturcture Memory
  61.         move.l   a7,a5
  62.         move.l   a7,myptr
  63.  
  64.         lea      egsintuiName(pc),a1
  65.         moveq    #0,d0
  66.         CALLLIB  _LVOOpenLibrary
  67.         move.l   d0,my_egsintui(a5)
  68.  
  69.         tst.l    d0
  70.         bne.s    1$
  71.  
  72.         ;------ couldn't find the library
  73.  
  74.         pea      egsintuiName(pc)
  75.         pea      nolibmsg(pc)
  76.         jsr      _printf
  77.         addq     #8,sp
  78.  
  79.         bra      main_end
  80. 1$:
  81.         lea      egsgfxName(pc),a1
  82.         moveq    #0,d0
  83.         CALLLIB  _LVOOpenLibrary
  84.         move.l   d0,my_egsgfx(a5)
  85.  
  86.         tst.l    d0
  87.         bne.s    2$
  88.  
  89.         ;------ couldn't find the library
  90.  
  91.         pea      egsgfxName(pc)
  92.         pea      nolibmsg(pc)
  93.         jsr      _printf
  94.         addq     #8,sp
  95.  
  96.         bra      main_end1
  97. 2$:
  98.         pea      egsintuiName(pc)
  99.         pea      Msg1(pc)
  100.         jsr      _printf
  101.         addq     #8,sp          ;fix 2 long stack pushes
  102.  
  103.         pea      egsgfxName(pc)
  104.         pea      Msg1(pc)
  105.         jsr      _printf
  106.         addq     #8,sp          ;fix 2 long stack pushes
  107.  
  108.         ;------ print the library name, version, and revision
  109.  
  110.         moveq    #0,d0
  111.  
  112.         pea      Msg2(pc)
  113.         jsr      _printf
  114.         addq     #4,sp          ;fix 1 long stack pushes
  115.  
  116.         ;------ call the first test function
  117.  
  118.         lea      mywin,a0
  119.  
  120.         LINKLIB  _LVOEI_OpenWindow,my_egsintui(a5)
  121.  
  122.         tst.l    d0
  123.         bne      3$
  124.  
  125.         pea      Msg4(pc)
  126.         jsr      _printf
  127.         addq     #4,sp          ;fix 1 long stack pushes
  128.  
  129.         bra      ende
  130. 3$:
  131.         move.l   d0,my_win(a5)
  132.         move.l   d0,a0
  133.         move.l   eiwi_UserPort(a0),my_port(a5)
  134.         move.l   eiwi_RPort(a0),my_rast(a5)
  135.  
  136.         move.l    my_rast(a5),a0
  137.         move.l    #$FF000000,d0             ;red
  138.         LINKLIB    _LVOEG_SetAPen,my_egsgfx(a5)
  139.  
  140.         move.l   my_rast(a5),a0
  141.         move.w   #50,d0
  142.         move.w   #50,d1
  143.         move.w   #100,d2
  144.         move.w   #100,d3
  145.         moveq    #0,d5
  146.  
  147.         LINKLIB   _LVOEG_RectFill,my_egsgfx(a5)
  148.  
  149. loop:
  150.         move.l    my_port(a5),a0
  151.         CALLLIB   _LVOWaitPort
  152.         move.l    my_port(a5),a0
  153.         CALLLIB   _LVOGetMsg
  154.         move.l    d0,my_msg(a5)
  155.         move.l    d0,a1
  156.         CALLLIB   _LVOReplyMsg
  157.  
  158.         move.l     my_msg(a5),a1
  159.         move.l    eims_Class(a1),d0
  160.         cmp.l     #EI_iCLOSEWINDOW,d0
  161.         bne       loop
  162.  
  163.         pea       Msg5(pc)
  164.         jsr       _printf
  165.         addq      #4,sp          ;fix 1 long stack pushes
  166.  
  167.         move.l    myptr,a5
  168.         move.l    my_win(a5),a0
  169.         LINKLIB   _LVOEI_CloseWindow,my_egsintui(a5)
  170.  
  171. ende:
  172.         move.l    myptr,a5
  173.         ;------ close the egsgfx.library
  174.         move.l    _AbsExecBase,a6
  175.         move.l    my_egsgfx(a5),a1
  176.         CALLLIB   _LVOCloseLibrary
  177.  
  178. main_end:
  179.         move.l    myptr,a5
  180.         ;------ close the egsintui.library
  181.         move.l    _AbsExecBase,a6
  182.         move.l    my_egsintui(a5),a1
  183.         CALLLIB   _LVOCloseLibrary
  184.  
  185. main_end1:
  186.         lea       my_SIZE(a7),a7
  187.         moveq     #0,d0
  188.         rts
  189.  
  190. myptr:       dc.l    0
  191.  
  192. mywin:       dc.w    100
  193.          dc.w    100
  194.          dc.w    350
  195.          dc.w    350
  196.          dc.w    200
  197.          dc.w    200
  198.          dc.w    3000
  199.          dc.w    3000
  200.          dc.l    0
  201.          dc.l    EI_WINDOWSIZE!EI_WINDOWCLOSE!EI_WINDOWBACK!EI_WINDOWDRAG
  202.          dc.l    0
  203.          dc.l    name
  204.          dc.l    0
  205.          dc.l    EI_iCLOSEWINDOW
  206.          dc.l    0
  207. color:
  208.          dc.l    0  ;1
  209.          dc.l    0  ;2
  210.          dc.l    0  ;3
  211.          dc.l    0  ;4
  212.          dc.l    0  ;5
  213.          dc.l    0  ;6
  214.          dc.l    0  ;8
  215.          dc.l    0  ;Menu
  216.          dc.l    0  ; Render
  217.  
  218. name:         dc.b   'Winddow',0
  219. egsgfxName:   dc.b   'egsgfx.library',0
  220. egsintuiName: dc.b   'egsintui.library',0
  221. nolibmsg:     dc.b   'Can not open library "%s"',10,0
  222. Msg1:         dc.b   'Open library "%s"',10,0
  223. Msg2:         dc.b   'Call EI_OpenWindw',10,0
  224. Msg4:         dc.b   'Cant Open Window',10,0
  225. Msg5:         dc.b   'Call EI_CloseWindow',10,0
  226.           cnop 4,0
  227.           END
  228.  
  229.  
  230.  
  231.